<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" href="css/my.css">
<link rel="stylesheet" type="text/css" href="css/my_right.css">
</head>
<body>
<div id='header'>			
	<jsp:include page="../common/header.jsp"></jsp:include>
</div>
<div id='main_play'>
	<div id='main_left'>
		<jsp:include page="../common/my_left.jsp"></jsp:include>
	</div>
	<div id='main_right' align="left">
		<div id="right_local">
			<div align="center"><font face="华康娃娃体W5(P)" size="4">个人好友管理</font></div>
			<font face="华康娃娃体W5(P)" size="4">好友管理</font>
			<div style="border: 1px #108AC6 solid;">
				<c:if test="${empty ensureFriends}">
					好友列表为空
				</c:if>
				
				<c:if test="${!empty ensureFriends}">
				<table border="1">
				<tr>
				<td>我的好友列表</td>
				</tr>
				<tr>
				<td>用户名</td><td>添加日期</td><td>操作</td>
				</tr>
				<c:forEach var="f"  items="${ensureFriends}" >
				<tr>
				<td><a href="member/MemberServlet?method=listById_member&isFriend=true&id=">${f.friend.userName}</a></td>
				<td>${f.time}</td>
				<td>
				<a href="friend.do?method=remove&friendId=${f.id}">解除好友关系</a>
				</td>
				</tr>
				</c:forEach>
				</table>
				</c:if>
			</div>
			<p>
			<font face="华康娃娃体W5(P)" size="4">好友请求管理</font>
			<div style="border: 1px #108AC6 solid;">
				<c:if test="${empty unsureFriends}">
					没有新好友请求
				</c:if>
				
				<c:if test="${!empty unsureFriends}">
				<table border="1">
				<tr>
				<td>新好友请求</td>
				</tr>
				<tr>
				<td>好友用户名</td><td>请求为好友时间</td><td>操作</td>
				</tr>
				<c:forEach var="f"  items="${unsureFriends}" >
				<tr>
				<td>${f.friend.userName}</td>
				<td>${f.time}</td>
				<td>
				<a href="javascript:void(0)" onclick="addFriend('${f.id}')">确认为好友</a>｜
				<a href="friend.do?method=remove&friendId=${f.id}">忽略</a>
				</td>
				</tr>
				</c:forEach>
				</table>
				</c:if>
			</div>
		</div>
		
	</div>
</div>
<div id='footer'></div>

<script type="text/javascript">
	function addFriend(id){
		var res = confirm('确定将他加为好友吗?');
		if(res){
			return window.open('friend.do?method=verify&friendId='+id,'添加好友','scrollbars=yes,width=500,height=300,alwaysRaised=1');
		}
	}
</script>



</body>
</html>